/*
 * Copyright 2023-2085 xujin <ceo@itgrail.com>
 *
 * Licensed under the Grail License, Version 1.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * https://itgrail.com/docs?id=3&catalogId=87
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.itgrail.pilot.domain.user.entity;

import com.itgrail.pilot.domain.user.repository.OkrPeriodRepository;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import com.itgrail.grail.ddd.annotation.domain.DomainAbility;
import com.itgrail.grail.ddd.annotation.domain.Entity;

import java.util.Date;


@Entity
@Data
public class OkrPeriodE {

    private OkrPeriodRepository okrPeriodRepository;

    private Integer id;

    @ApiModelProperty("周期长度")
    private String periodLength;

    @ApiModelProperty("周期类型 默认为月  0月 1季度 2年")
    private Byte periodType;

    @ApiModelProperty("生效日期")
    private String startDate;

    @ApiModelProperty("是否开启年度okr  默认0开启  1关闭")
    private Byte yearEnable;

    @ApiModelProperty("是否开启 1关闭 0启用")
    private Byte showEnable;

    private Integer created;

    private Integer updated;

    private Byte deleted;

    private Byte isEdit;

    @ApiModelProperty("是否开启展示我的okr评论  默认0开启  1关闭")
    private Byte myCommentEnable;

    @ApiModelProperty("是否开启展示领导okr评论  默认0开启  1关闭")
    private Byte leaderCommentEnable;

    @ApiModelProperty("是否开启是否展示全部okr评论  默认0开启  1关闭")
    private Byte allCommentEnable;

    @ApiModelProperty("开始日期 yyyy-MM")
    private Date startTime;

    @ApiModelProperty("结束日期 yyyy-MM")
    private Date endTime;

    private String name;

    private String extInfo;


    @DomainAbility
    public int save() {
        return okrPeriodRepository.save(this);
    }

    @DomainAbility
    public int update() {
        return okrPeriodRepository.update(this);
    }

    @DomainAbility
    public int delete() {
        return okrPeriodRepository.delete(this);
    }

}
